from module.static_module.parent.view import AdditionWindowView
from core.constant import *
from tools.view import *


class RevenueCalculateView(AdditionWindowView):
    def __init__(self, super_model):
        super().__init__(super_model)

    def create_layout_init(self):
        # 绘制标签、内容组件
        # 配置参数
        cost_ls = self.super_model.cost_ls  # 成本
        profit_probability_ls = self.super_model.profit_probability_ls  # 盈利概率
        profit_cost_multiple_ls = self.super_model.profit_cost_multiple_ls  # 盈利相对于成本的倍数
        loss_cost_multiple_ls = self.super_model.loss_cost_multiple_ls  # 亏损相对于成本的倍数

        label_config = [
            [LabelMember.Cost, WidgetCategory.Entry, cost_ls, [0]],
            [LabelMember.ProfitProbability, WidgetCategory.Entry, profit_probability_ls, [0]],
            [LabelMember.ProfitCostMultiple, WidgetCategory.Entry, profit_cost_multiple_ls, [0]],
            [LabelMember.LossCostMultiple, WidgetCategory.Entry, loss_cost_multiple_ls, [0]]
        ]
        button_config = [
            [ButtonMember.Ok, WidgetCategory.Button, None]
        ]
        self.auto_layout = AutoLayout(self.frame, label_config, button_config)
        self.auto_layout.button_command(self)


